package com.service;

import com.mapper.AlltypeMapper;
import com.mapper.CoachMapper;
import com.mapper.CourseMapper;
import com.po.Alltype;
import com.po.Coach;
import com.po.Course;
import com.vo.CourseQuery;
import com.vo.TrainerCourseQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 阳幸子 on 2018/5/8.
 */
@Service
public class CourseService {
    @Autowired
    private CourseMapper courseMapper;
    @Autowired
    private AlltypeMapper alltypeMapper;

    @Autowired
    private CoachMapper coachMapper;

    public List<Coach> selectAllCoach(){
        return coachMapper.selectAllCoach();
    }
    public List<Alltype> selectAlltype(){
     return alltypeMapper.selectAllType();
    }

    public void insertCourse(Course course){
        courseMapper.insertCourse(course);
    }
    public int count(){
        return courseMapper.count();
    }
    public int countEvent(){
        return courseMapper.countEvent();
    }
    public List<Course> selectCourseByPage(int page){
        return courseMapper.selectCourseByPage(page);
    }
    public Alltype selectTypeById(long id){
        return alltypeMapper.selectById(id);
    }
    public Coach selectCoachById(long id){
        return coachMapper.selectById(id);
    }
    public Course selectCourseById(long id){
        return courseMapper.selectById(id);

    }
    public List<Course> selectAll(CourseQuery courseQuery){
        return courseMapper.selectAll(courseQuery);
    }
    public List<Course> selectCourseByTrainer(TrainerCourseQuery trainerCourseQuery){
        return courseMapper.selectCourseByTrainer(trainerCourseQuery);
    }
    public List<Course> selectEventByTrainer(TrainerCourseQuery trainerCourseQuery){
        return courseMapper.selectEventByTrainer(trainerCourseQuery);
    }
    public void updateCourse(Course course){
        courseMapper.updateById(course);
    }

    public List<Course> selectEventByPage(int page){
        return courseMapper.selectEventByPage(page);
    }



    public void delCourse(long id){
        courseMapper.delById(id);
    }
}
